package com.ybbase.framework.common.util;

/**
 * 生成机器注册码
 * @author cg
 * @date 2019-10-14 16:09
 * @since 4.0
 */
public class GeneratorCode {

    /**
     * 系统编码
     * */
    private final static String KEY_PARAM_ONE = "TSMIS";
    /**
     * 煤矿编码
     * */
    private final static String KEY_PARAM_TWO = "0100015";
    /**
     * 日期
     * */
    private final static String DATE_STR = "2019-11-01 23:59:59";
    /**
     * 密码
     * */
    private final static String KEYS="f9340e9260c552f59c34c0131fc4806a";


    /**
     * 加密产品序列码
     * @return
     * @author cg
     * @date 2019-10-14 16:56
     * @since 4.0
    */
    private static String getEncodeKeys(){
        EncryptUtil encryptUtil = EncryptUtil.getInstance();
        return encryptUtil.desEncode(KEY_PARAM_ONE+"_"+KEY_PARAM_TWO+"_"+DateUtil.getTimeStamp(DATE_STR), KEYS);
    }

    /**
     * 加密串解密
     * @param res 加密串
     * @return
     * @author cg
     * @date 2019-10-14 16:57
     * @since 4.0
    */
    public static String getDecodeKeys(String res){
        EncryptUtil encryptUtil = EncryptUtil.getInstance();
        return encryptUtil.desDecode(res, KEYS);
    }

    public static void main(String[] args){
        //生成加密产品序列码
        System.out.println(getEncodeKeys());
    }

}
